package com.example.localbites;

import java.util.List;

import com.example.constants.StringConstant;
import com.example.dbaccess.LocalBitesDB;
import com.example.yelp.service.beans.Business;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.widget.ListView;

public class Favorite_list extends Activity {

	private ListView listviewRestaurant;
	private Context ctx;
	private LocalBitesDB localBitesDB;
	private List<Business> dbData;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.favorite_activity);
		ctx=this;
		
		/*//Delete DB Data
		localBitesDB = new LocalBitesDB(this);
		localBitesDB.open();
		localBitesDB.deleteData();
		localBitesDB.close();*/
		
		//Displaying DB List Data
		localBitesDB = new LocalBitesDB(this);
		localBitesDB.open();
		dbData = localBitesDB.getRestaurantData();
		localBitesDB.close();
		listviewRestaurant = (ListView) findViewById(R.id.databaseList);
		listviewRestaurant.setAdapter( new RestaurantAdapter(ctx, R.layout.activity_list_row, dbData));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.favorite_list, menu);
		return true;
	}

}
